import {Action, getModule, Module, Mutation, VuexModule} from "vuex-module-decorators";
import store from "@/store";

@Module({
    name:"user",
    dynamic:true,
    store
})
class User extends VuexModule{
    count = 20;

    get halfCount(){
        return this.count / 2;
    }

    @Mutation
    REDUCE_COUNT(payload:number){
        this.count = this.count - payload;
    }

    @Action
    dispatchReduce(payload:number){
        this.context.commit("REDUCE_COUNT",payload);
    }
}
export const UserModule = getModule(User);
